package com.inspirationandgenius.welcome;

import com.lifeofdata.inspirationandgenius.R;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;

public class Tower extends Activity implements OnClickListener {

	private Intent intent; 
	private boolean started=true;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.welcome);
        
        setContentView(R.layout.welcome);
        
        Button button = (Button) findViewById(R.id.btnradio);
        button.setOnClickListener(this);
        Button closebtn = (Button) findViewById(R.id.closebtn);
        closebtn.setOnClickListener(this);
        Button logout = (Button)findViewById(R.id.lifeofdata);
        logout.setOnClickListener(this);
    }

  
	public void onClick(View v) {
		
		switch(v.getId())
		{
			case R.id.btnradio:
				
				if(started)
				{
					intent = new Intent(this, Radio.class);
					intent.putExtra("igcnuserid", this.getIntent().getExtras().getString("igcnuserid"));
					intent.putExtra("loginn", this.getIntent().getExtras().getString("loginn"));
					this.startActivityForResult(intent, 369852);
					started=false;
				}
				else
				{	
					intent.setClassName(this,"com.inspirationandgenius.welcome.Radio");
					intent.putExtra("igcnuserid", this.getIntent().getExtras().getString("igcnuserid"));
					intent.putExtra("loginn", this.getIntent().getExtras().getString("loginn"));
					this.startActivityForResult(intent, 369852);
				}
				
				break;
				
			case R.id.closebtn:
					finish();
					break;
					
			case R.id.lifeofdata:
				
				if(this.getIntent().getExtras()!=null)
				{
					DBAdapter db = new DBAdapter(this);
				     db.open();
					db.logout_igUser(this.getIntent().getExtras().getString("loginn"),this.getIntent().getExtras().getString("pwdd"));
					Intent welcome = new Intent(getApplicationContext(), ControlTower.class);
					startActivity(welcome);
					db.close();
					finish();
				}
			
			
			default: break;
		}
		
	}
}
